<%@page import="com.yh.entity.Zhanfeng"%>
<%@page import="cn.hutool.extra.servlet.ServletUtil"%>
<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>session</title>
		<style type="text/css">
		pre {
			font-size: 2rem;
			line-height: 2;
		}
		</style>
	</head>
	<body>
		<pre><%
		//HttpSession session = request.getSession();//session是jsp的内置对象
		//session= request.getSession();//实际不要写
		out.println("session.getId="+session.getId());
		out.println("Cookie"+ServletUtil.getCookie(request, "JSESSIONID"));
		out.println("Cookie:");
		Cookie[] cs = request.getCookies();
		if(cs!=null){
			for(Cookie c : cs) {
				out.println("\t"+c.getName()+"="+c.getValue());
			}
		}
		Zhanfeng user = new Zhanfeng();
		user.setZfName("yh");
		session.setAttribute("user", user);
		%></pre>
		
		<a href="session-2.jsp">session-2.jsp</a>
	</body>
</html>